#coding:utf-8
__author__ = 'yangxianming'
import requests


def to_remote(case_id, batch_No, result, testResult="", expectResult="", system_err_code=0):
    #system_err_code 系统错误懂代码 0：没有系统错误   1：测试参数获取失败   2：数据库链接失败
    """

    :type batch_No: object
    """
    url = "http://test.e-fuli.cn/caseManager/saveReport"
    # res = None
    if result:
        if result == -2:
            res = "-2"
        else:
            res = "1"
    else:
        res = "0"

    if system_err_code != 0:
        res = system_err_code
    # return_data = return_data.encode('utf-8')
    params = {"caseId": case_id, "batchNo": batch_No, "result": res, "type":"3", "testResult": str(testResult), "expectResult":str(expectResult)}
    r = requests.post(url, data=str(params).encode('utf-8'))
    # print(r.status_code)
    print(r._content)